package sctu.edu.java.year2016.team01.xuhanmei.day20160607.chapter15_1;

/**
 * Created by Administrator on 2016/6/7.
 * 尝试定义一个继承Thread的类，并覆盖run（）方法，在run（）方法中每隔100毫秒打印一句话
 */
public class PrintWords extends Thread{
    public void run(){
        for( int i = 0;i<100;i++){
            System.out.println("每隔100毫秒打印一句话");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        PrintWords printWords=new PrintWords();
        printWords.start();
    }

}
